<template>
	<view class="login">
		<view class="logo">
			<view class="imgs">
				<image src="/static/icons/hei.jpg" mode=""></image>
			</view>
		</view>
		<view class="login-main">
			<form @submit="formSubmit">
				<view class="uni-form-item uni-column">
					<input value="12345678911" class="uni-input" name="tel" placeholder="手机号" />
				</view>
				<view class="uni-form-item uni-column">
					<input value="123456" type="password" class="uni-input" name="password" placeholder="登录密码" />
				</view>
				<view class="uni-form-item uni-column">
					<input value="花葬" class="uni-input" name="username" placeholder="用户名" />
				</view>
				<view class="uni-form-item uni-column">
					<input value="hh" class="uni-input" name="nickname" placeholder="昵称" />
				</view>
				<view class="uni-form-item uni-column">
					<input class="uni-input" name="avatar" placeholder="验证码" />
				</view>
				<!-- #ifdef H5 -->
				<QSWavesButton wavesColor="#fff" class="btn" txt="注册" form-type="submit"></QSWavesButton>
				<!-- #endif -->
				<!-- #ifdef MP-WEIXIN -->
				<QSWavesButton wavesColor="#fff" txt="注册" form-type="submit"></QSWavesButton>
				<!-- #endif -->
				<!-- hover-class="btnactive" -->
				<!-- 	<button hover-class="btnactive" class="btn" form-type="submit">登录</button> -->
			</form>
			<!-- <view class="icons-main">
				<view class="icons-item" v-for="(item, index) in iconsList" :key="index">
					<image :src="item" mode=""></image>
				</view>
			</view>
			<view class="login-bottom">
				<view class="left">找回密码</view>
				<view class="right" @tap="registerClick">注册账号</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		getRegister
	} from '@/network/profile/index.js'
	import QSWavesButton from '@/components/QS-WavesButton/QS-WavesButton.vue';
	export default {
		data() {
			return {
				iconsList: ['/static/icons/weixin.png', '/static/icons/weibo.png', '/static/icons/github.png']
			};
		},
		components: {
			QSWavesButton
		},
		methods: {
			async formSubmit(e) {
				console.log(e) // 登录
				const datas = e.detail.value;
				console.log(datas)
				datas.avatar = "https://bufan-cloud.oss-cn-beijing.aliyuncs.com/leju_test/20191212151304.jpg"
				// datas.avatar = "/static/icons/github.png"
				console.log(datas)
				const res = await getRegister(datas)
				uni.showToast({
					title: '注册成功',
					success(res) {
						console.log('hhh')
					}
				})
				console.log(res, '哈哈')
				// 等待时间 让toast 显示出来
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/profile/login/login'
					})
				}, 1000)
				

			},

		}
	}
</script>

<style lang="scss" scoped>
	.login {
		// height: 100vh;
		height: 100%;
		background-color: #F1ECE7;
	}

	.logo {
		display: flex;
		justify-content: center;
		padding: 120rpx 0 80rpx;

		.imgs {
			width: 212rpx;
			height: 212rpx;
			border-radius: 50%;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.login-main {
		padding: 0rpx 108rpx 40rpx;

		.login-bottom {
			display: flex;
			justify-content: center;

			.left,
			.right {
				padding: 0 20rpx;
				border-right: 2rpx solid #B5B0B5;
			}

			.right {
				border: none;
			}
		}

		.uni-form-item {
			background-color: #fff;
			padding: 30rpx;
			padding-left: 50rpx;
			border-radius: 80rpx;
			font-size: 28rpx;
			margin: 24rpx 0;
		}

		.icons-main {
			display: flex;
			justify-content: space-around;
			margin: 40rpx 0;

			.icons-item {
				width: 64rpx;
				height: 64rpx;
				border-radius: 50%;
				background-color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;

				// overflow: hidden;
				image {
					width: 80%;
					height: 80%;
				}
			}
		}

		.btn {
			width: 100%;
			margin: 100rpx 0;
			padding: 20rpx;
			border-radius: 80rpx;
			font-size: 28rpx;
			background-color: #354E44;
		}
	}
</style>
